﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NationalInstruments.TestStand.Interop.API;
using Newtonsoft.Json.Linq;

namespace CLVisionEICS
{
    internal interface ICLEICSClient
    {
        //订阅数据返回事件
        Action<string> EventReceivedMessage { set; get; }

        // 新增断开连接事件
        Action<string> EventDisconnected { set; get; }

        JObject eicsJson { set; get; }

        bool IntMqttClient(string server, int port, string username, string password, string topicName, string clientId, out int ErrorCode, out string ErrorText, string cdatFilePath = null);
        bool PublishData(string topicName, string mesData, MQTTnet.Protocol.MqttQualityOfServiceLevel qos, out int ErrorCode, out string ErrorText);
        bool SubscribeTopic(out int ErrorCode, out string ErrorText, params string[] topicNames);

        bool UnsubscribeTopic(out int ErrorCode, out string ErrorText, params string[] topicNames);

        bool DisconnectMqttClient(out int ErrorCode, out string ErrorText);

        bool ReceiveDataWithTimeout(out string receivedMessage, out int ErrorCode, out string ErrorText, int timeoutMs = 3000, int pollIntervalMs = 50);

        bool SetEICSValueByKey(string key,object value, out int ErrorCode, out string ErrorText);

        bool SetEICSValueByKey(PropertyObject key, out int ErrorCode, out string ErrorText);

        bool SetEICSValueByArrayString(string value, out int ErrorCode, out string ErrorText);

        bool SetEICSValuesByKeys(PropertyObject values, out int ErrorCode, out string ErrorText);
    }
}
